import time

from playwright.sync_api import Playwright, sync_playwright, expect


def run(playwright: Playwright) -> None:
    browser = playwright.chromium.launch(headless=False)
    context = browser.new_context(storage_state="auth.json")
    page = context.new_page()
    page.goto("https://v.douyin.com/iNKppptd/ 4@5.com :8pm")

    # ---------------------
    while True:
        context = page.context
        print(context)
        time.sleep(10)
    context.close()
    browser.close()

    """
    0- #在抖音，记录美好生活#【掌机小精灵李狗蛋】正在直播，来和我一起支持Ta吧。复制下方链接，打开【抖音】，直接观看直播！ https://v.douyin.com/iNKppptd/ 4@5.com :8pm"""


with sync_playwright() as playwright:
    run(playwright)
